﻿//---------------------------------------------------------------------------------
// Copyright 2011 Microsoft Corporation
// Licensed under the Microsoft Public License (MS-PL) (the "License"); 
// You may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.opensource.org/licenses/ms-pl.html
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR 
// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, 
// INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 
// CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
// MERCHANTABLITY OR NON-INFRINGEMENT. 
// See the Microsoft Public License (MS-PL) for the specific language governing 
// permissions and limitations under the License.
//---------------------------------------------------------------------------------
using System.Configuration;

namespace Microsoft.Telco.WindowsLive
{
	public static class LiveConfiguration
	{

		/// <summary>
		/// Gets the consent root.
		/// </summary>
		/// <value>The consent root.</value>
		public static string ConsentRoot
		{
			get
			{
				return ConfigurationManager.AppSettings["liveConsentRoot"];
			}
		}

		/// <summary>
		/// Gets the client id.
		/// </summary>
		/// <value>The client id.</value>
		public static string ClientId
		{
			get
			{
				return ConfigurationManager.AppSettings["liveClientId"];
			}
		}

		/// <summary>
		/// Gets the client secret.
		/// </summary>
		/// <value>The client secret.</value>
		public static string ClientSecret
		{
			get
			{
				return ConfigurationManager.AppSettings["liveClientSecret"];
			}
		}

		/// <summary>
		/// Gets the wrap callback.
		/// </summary>
		/// <value>The wrap callback.</value>
		public static string WrapCallback
		{
			get
			{
				return ConfigurationManager.AppSettings["liveWrapCallback"];
			}
		}

		private static string ConsentUri = "https://consent.live.com/Connect.aspx?wrap_client_id={0}&wrap_callback={1}&wrap_scope=WL_Contacts.View";

		/// <summary>
		/// Gets the WindowsLive OAuth consent URI.
		/// </summary>
		/// <value>The WindowsLive OAuth consent URI.</value>
		public static string WindowsLiveOAuthConsentUri
		{
			get
			{
				return string.Format(ConsentUri, ClientId, WrapCallback);
			}
		}
	}
}
